<template>
  <div class="mutualattention">
    <!-- 顶部导航栏 -->
    <head-nav-bar>
      <template #left>
        <div class="head_name" @click="back">
          <img class="return" src="../../images/return.png" alt="" />
          <span class="return_">返回</span>
        </div>
      </template>
      <template #center>
        <div class="head_name2">我发布的帖子</div>
      </template>
    </head-nav-bar>
    <div class="kongbai"></div>
    <div class="center">
      <!-- 组件 -->
      <post></post>
    </div>
  </div>
</template>
<script>
import HeadNavBar from "../../../components/HeadNavBar";
import Post from "../../../components/minePost";

export default {
  props: {},
  created() {},
  data() {
    return {};
  },
  sockets: {
    receiveMsg(data) {
      console.log(data);
      let datas = this.$store.state.userinfo.userList;
      // console.log(datas);
      var flag = true;
      if (datas.length === 0) {
        this.$store.commit("setuserList", data);
      } else {
        for (let i = 0; i < datas.length; i++) {
          // console.log(datas[i]);
          if (datas[i].userid === data.userid) {
            datas[i].content = data.content;
            // console.log("第二次发");
            flag = false;
            break;
          }
        }
        if (flag === true) {
          this.$store.commit("setuserList", data);
          // console.log("第一次发");
        }
      }
    }
  },
  methods: {
    back() {
      this.$router.push("/admin");
    }
  },
  watch: {},
  components: {
    HeadNavBar,
    Post
  }
};
</script>
<style scoped>
a {
  text-decoration: none;
  color: rgb(212, 212, 212);
}

.mutualattention {
  background-color: #ececec;
}
.head_name {
  position: absolute;
  height: 25px;
  width: 60px;
  line-height: 25px;
}
.return {
  position: absolute;
  top: 2px;
  height: 21px;
  width: 21px;
}
.return_ {
  position: absolute;
  top: 0;
  left: 22px;
  height: 25px;
  line-height: 25px;
}
.head_name2 {
  margin: 0 auto;
}

.center {
  width: 96%;
  margin: 0 auto;
}
</style>
